import java.util.ArrayList;

/**
 * IDE: Eclipse
 *
 * @author Justin Niles
 * @author Grant Foster
 * @author Bryce Langlotz
 * @author Max Honosky
 *
 */
public class AtomArray extends ArrayList<Atom>
{
    public float getXMin()
    {
        float xMin = this.get(0).xPos;
        for (Atom atom : this)
        {
            if (atom.xPos - atom.radius < xMin)
            {
                xMin = atom.xPos;
            }
        }
        return xMin;
    }
    public float getXMax()
    {
        float xMax = this.get(0).xPos;
        for (Atom atom : this)
        {
            if (atom.xPos + atom.radius > xMax)
            {
                xMax = atom.xPos;
            }
        }
        return xMax;
    }
    public float getYMin()
    {
        float yMin = this.get(0).yPos;
        for (Atom atom : this)
        {
            if (atom.yPos - atom.radius < yMin)
            {
                yMin = atom.yPos;
            }
        }
        return yMin;
    }
    public float getYMax()
    {
        float yMax = this.get(0).yPos;
        for (Atom atom : this)
        {
            if (atom.yPos + atom.radius > yMax)
            {
                yMax = atom.yPos;
            }
        }
        return yMax;
    }
    public float getZMin()
    {
        float zMin = this.get(0).zPos;
        for (Atom atom : this)
        {
            if (atom.zPos - atom.radius < zMin)
            {
                zMin = atom.zPos;
            }
        }
        return zMin;
    }
    public float getZMax()
    {
        float zMax = this.get(0).zPos;
        for (Atom atom : this)
        {
            if (atom.zPos + atom.radius > zMax)
            {
                zMax = atom.zPos;
            }
        }
        return zMax;
    }

    public void printBounds()
    {
        System.out.println("XMin: " + this.getXMin() + " XMax: " + this.getXMax());
        System.out.println("YMin: " + this.getYMin() + " YMax: " + this.getYMax());
        System.out.println("ZMin: " + this.getZMin() + " ZMax: " + this.getZMax());
    }
}

class Atom
{
    public float xPos;
    public float yPos;
    public float zPos;
    public float radius;

    public Atom() {}
    public Atom(float x, float y, float z, float r)
    {
        xPos = x;
        yPos = y;
        zPos = z;
        radius = r;
    }

    public String toString()
    {
        return "x: " + xPos + " y: " + yPos + " z: " + zPos;
    }
}